<?php

namespace App\Service\UserCenter;

use App\Model\Withdraw;
use App\Service\BaseService;

use App\Constants\ErrorCode;
/**
 * 提现记录列表
 */
class WithdrawListService extends BaseService
{
    public function handle()
    {
	$userId = $this->getUserId();
	//$userId = 1;
        $page = $this->request->input('page', 1);
        //最大可提现
        $withdrawLogs = Withdraw::getList($userId, $page, $this->pageNum);
	//return $this->setError(ErrorCode::PARAMETER_ERROR, $withdrawLogs);
 	$ret = ['list' => []];
        array_walk($withdrawLogs, function ($log) use (&$ret) {
            $ret['list'][] = Withdraw::buildItem($log);
        });      
	return $ret;
    }
}
